<section class="panel">
<link rel="stylesheet" href="<?php echo base_url();?>js/datatables/datatables.css" type="text/css" />
<script src="<?php echo base_url();?>js/jquery.min.js"></script>
<script src="<?php echo base_url();?>js/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript">
/* function filterGlobal () {
    $('#tabel').DataTable().search(
        $('#cari').val()
       
    ).draw();
} */
 

 
$(document).ready(function() {

     oTable = $('#tabel').dataTable();
 
    $('#cari').on( 'keyup click', function () {
        /* filterGlobal(); */
		
		oTable.fnFilter( $(this).val()
		)
		;
    } 
)
;
} );
</script>
	<div class="row text-sm wrapper">
		<div class="col-sm-3">
			<div class="input-group">
				<input type="text" class="input-sm form-control" id="cari" placeholder="Search">
				<span class="input-group-btn">
					<button class="btn btn-sm btn-info" type="button">Go!</button>
				</span>
			</div>
		</div>
	</div>
<div class="table-responsive">
	<table id = "tabel" class="table table-striped b-t text-sm">
		<thead>
			<tr>
				<th class="th-sortable" data-toggle="class">No
					<span class="th-sort">
						<i class="fa fa-sort-down text"></i>
						<i class="fa fa-sort-up text-active"></i>
						<i class="fa fa-sort"></i>
					</span>
				</th>
				<th>Lihat</th>
				<th>Nama lengkap</th>
				<th>Sekolah</th>
				<th>Tanggal Pengajuan</th>
				<th>Tanggal Persetujuan</th>
				<th>Status</th>
		  </tr>
		</thead>
		<tbody>
			<?php
				$i	= 0;
				foreach($get as $row){
				$i++;
			?>
				<tr>
					<td><?php echo $i; ?></td>
					<td><a href="<?php echo site_url('admin/adlegalisir/lihatPersetujuan/' . $row["ID_PENGAJUAN"]);?>">Lihat</a></td>
					<td><?php echo $row["NAMA_LENGKAP"]; ?></td>
					<td><?php echo ($row["TK2"] == 0 || $row["TK2"] == null || $row["TK2"] == "") ? ($row["TK1"]) : (($row["TK3"] == 0 || $row["TK3"] == null || $row["TK3"] == "") ? ($row["TK1"] . $row["TK2"]) : ($row["TK1"] . $row["TK2"] . $row["TK3"])); ?></td>
					<td><?php echo ($row["TGL_PENGAJUAN"] == "" || $row["TGL_PENGAJUAN"] == null || $row["TGL_PENGAJUAN"] == "0000-00-00") ? ("-") : (date("d-m-Y",strtotime($row["TGL_PENGAJUAN"]))); ?></td>
					<td><?php echo ($row["TGL_VERIFIKASI_KADIN"] == "" || $row["TGL_VERIFIKASI_KADIN"] == null || $row["TGL_VERIFIKASI_KADIN"] == "0000-00-00") ? ("-") : (date("d-m-Y",strtotime($row["TGL_VERIFIKASI_KADIN"]))); ?></td>
					<td></td>
				</tr>
			<?php
			}
			?>
		</tbody>
	</table>
</div>
<footer class="panel-footer">
	<div class="row">
		<div class="col-sm-4 text-left">
			<small class="text-muted inline m-t-sm m-b-sm"><?php
				$itemPerPage = 5;
				$page=1;
				if($_SERVER['QUERY_STRING'] != null){
					$page = explode('=', $_SERVER['QUERY_STRING']);
					$page = $page[1];
				}
				if($total < 1)
					$first	= 0;
				else
					$first	= ($itemPerPage * ($page-1)) + 1;
				$last = $first + $itemPerPage - 1;
				if($last > $total)
					$last = $total;
				echo "showing $first-$last of $total items";
			?></small>
		</div>
		<div class="col-sm-4 text-right text-center-xs pull-right">                
			<ul class="pagination pagination-sm m-t-none m-b-none">
				<li><a href="<?php
					$page=1;
					if($_SERVER['QUERY_STRING'] != null){
						$page = explode('=', $_SERVER['QUERY_STRING']);
						$page = $page[1];
					}
					if($page > 1){
						$page--;
						echo "?page=$page";
					}
					else
						echo "#";
				?>"><i class="fa fa-chevron-left"></i></a></li>
				<?php
					$pages = ceil($total/$itemPerPage);
					for($i = 1; $i <= $pages; $i++){
						echo "<li><a href=?page=$i>$i</a></li>";
					}
				?>
				<li><a href="<?php
					$page=1;
					if($_SERVER['QUERY_STRING'] != null){
						$page = explode('=', $_SERVER['QUERY_STRING']);
						$page = $page[1];
					}
					if($page < ceil($total/$itemPerPage)){
						$page++;
						echo "?page=$page";
					}
					else
						echo "#";
				?>"><i class="fa fa-chevron-right"></i></a></li>
			</ul>
		</div>
	</div>
</footer>
</section>